import request from '@/utils/request'

export default {
  getUploadHistoryList(searchModel) {
    return request({
      url: '/myboard/data/queryUploadHistory',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize,
        jobId: searchModel.jobId,
        limit: searchModel.limit
      }
    })
  },
  uploadData(dataForm) {
    return request({
      url: '/myboard/data/uploadData',
      method: 'post',
      params: {
        table_name: dataForm.table_name
      }
    })
  },
  uploadFile(file, dataForm) {
    const fd = new FormData()
    fd.append('filename', file)
    const config = { headers: { 'Content-Type': 'multipart/form-data' }}
    return request({
      url: '/myboard/data/uploadFile',
      method: 'post',
      headers: config,
      data: fd,
      params: {
        table_name: dataForm.table_name,
        head: dataForm.head,
        partition: dataForm.partition,
        namespace: dataForm.namespace,
        count: dataForm.count,
        drop: dataForm.drop
      }
    })
  }

}
